<?php

namespace app\app\model\shop;

use app\app\model\goods\GoodsCategoryModel;
use think\Model;

class ShopGoodsCategoryModel extends Model
{
    protected $name = 'shop_goods_category';


    /**
     * Notes: 查询店铺分类
     * User: AerYYY
     * Date: 7/2/25
     * @param $shop_id
     * @return bool|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function list($shop_id)
    {
        return $this->alias('sc')->join('goods_category g', 'g.id = sc.goods_category_id')
            ->where('status', GoodsCategoryModel::STATUS_ZC)
            ->where('sc.shop_id', $shop_id)->field('g.id,g.name,g.avatar')
            ->order('g.weigh desc')->select();
    }

}